function rest = matA(n,term)

thebij;
load funcbij;
thehij;
load funchij;

rest=sparse(zeros(term*(n-1)));
for ii=1:term
    for jj=1:term
        rest((ii-1)*(n-1)+1:ii*(n-1),(jj-1)*(n-1)+1:jj*(n-1)) ...
            =matelt(bij{jj}{ii},hij{jj}{ii},n);
    end
end


% switch term
%     case 1
%         rest=matelt(bij{1}{1},hij{1}{1},n);
%     case 2
%         rest=[matelt(bij{1}{1},hij{1}{1},n), matelt(bij{2}{1},hij{2}{1},n); ...
%               matelt(bij{1}{2},hij{1}{2},n), matelt(bij{2}{2},hij{2}{2},n)];
%     case 3
%         rest=[matelt(bij{1}{1},hij{1}{1},n), matelt(bij{2}{1},hij{2}{1},n), matelt(bij{3}{1},hij{3}{1},n); ...
%               matelt(bij{1}{2},hij{1}{2},n), matelt(bij{2}{2},hij{2}{2},n), matelt(bij{3}{2},hij{3}{2},n); ...
%               matelt(bij{1}{3},hij{1}{3},n), matelt(bij{2}{3},hij{2}{3},n), matelt(bij{3}{3},hij{3}{3},n)];
%     case 4
%         rest=[matelt(bij{1}{1},hij{1}{1},n), matelt(bij{2}{1},hij{2}{1},n), matelt(bij{3}{1},hij{3}{1},n), matelt(bij{4}{1},hij{4}{1},n); ...
%               matelt(bij{1}{2},hij{1}{2},n), matelt(bij{2}{2},hij{2}{2},n), matelt(bij{3}{2},hij{3}{2},n), matelt(bij{4}{2},hij{4}{2},n);...
%               matelt(bij{1}{3},hij{1}{3},n), matelt(bij{2}{3},hij{2}{3},n), matelt(bij{3}{3},hij{3}{3},n), matelt(bij{4}{3},hij{4}{3},n);...
%               matelt(bij{1}{4},hij{1}{4},n), matelt(bij{2}{4},hij{2}{4},n), matelt(bij{3}{4},hij{3}{4},n), matelt(bij{4}{4},hij{4}{4},n)];
%     otherwise
%         rest=[];
% end